package com.ucas.test;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.ServerSocket;
import java.net.Socket;

public class SocketServer {
	public static void main(String[] args) {
		try {
			ServerSocket server = new ServerSocket(9090);
			Socket client = server.accept();
			InputStream is = client.getInputStream();
			InputStreamReader isr = new InputStreamReader(is,"utf-8");
			BufferedReader br = new BufferedReader(isr);
			byte[] b = new byte[1024];
			String message;
			while((message = br.readLine())!=null) {
				System.out.println(message);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
